package com.usian.article.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.usian.article.mapper.ApAuthorMapper;
import com.usian.article.service.ApAuthorService;
import com.usian.model.article.pojos.ApAuthor;
import com.usian.model.base.BaseServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class ApAuthorServiceImpl extends BaseServiceImpl<ApAuthorMapper, ApAuthor> implements ApAuthorService {


    @Override
    public ApAuthor findByUserId(Integer id) {

        LambdaQueryWrapper<ApAuthor> eq = new QueryWrapper<ApAuthor>().lambda().eq(ApAuthor::getUserId, id);
        return getOne(eq);
    }

    public ApAuthor selectAuthorByName(String name) {
        LambdaQueryWrapper<ApAuthor> eq = new QueryWrapper<ApAuthor>().lambda().eq(ApAuthor::getName, name);
        return getOne(eq);
    }
}
